const constantRouterMap=[
    {
        path:'/',
        meta:{
            title:'登录'
        },
    
        component:(resolve)=> require(['../components/login.vue'],resolve)
    },
    {
        path:'/Mainpage/',
        
        meta:{
            title:'主页'
            
        },
    
        component:()=> import('../views/Mainpage.vue'),
        children:[
            {path:'/Mainpage/file',component:(resolve)=>require(['@/components/file.vue'],resolve),},
            {
                path:'/Mainpage/share',
                meta:{
                    title:'分享'
                },
            
                component:(resolve)=> require(['../components/share.vue'],resolve)
            },
            {
                path:'/Mainpage/comment',
                meta:{
                    title:'评论'
                },
            
                component:(resolve)=> require(['../components/comment.vue'],resolve)
            }
        ]
    },
/*{
    path:'/Mainpage/file',
    meta:{
        title:'文件'
    },

    component:(resolve)=>require(['@/components/file.vue'],resolve),
    
},*/
]
//const ISLOGIN = true 
// constantRouterMap.beforeEach((to, from, next) => {   //全局全局前置守卫
//     //to : 将要进入的目标路由对象
//     //from : 即将离开的目标路由对象
//     //执行跳转的下一步钩子
//     console.log(to)
//     console.log(from)
//     if(to.path != '/'){ //如果不是登录页面
//       if(ISLOGIN)next()   //已登录就执行跳转
//       else next({path:'/'})   //否则跳转到登录页面
//     }else{ //如果是登录页面
//       if(ISLOGIN)next({path:'/'}) //已登录就跳转到首页
//       else  next()  //否则正常进入登录页面
//     }
//   })
  



export default constantRouterMap